<?php
class IndexController extends Zend_Controller_Action
{
public $filters=array('search'=>array('HtmlEntities','StripTags','StringTrim','Alnum'));
public $validators=array('search'=>array());
public $result;
public $searchform;	
public $loginform;
	public function preDispatch()
	{}

    public function init()
    {
	
    }

    public function indexAction()
    {
        Myblog_Model_Tokens::deloldTokens();
        $this->redirect('/main');

    }

    public function logoutAction()
    {
    $auth = Zend_Auth::getInstance();
    	if($auth->hasIdentity())
    	{
    	$auth->clearIdentity();
    	Zend_Session::destroy();
    		$this->redirect('/main');
    		
    	}
    }
    
	 public function messageAction()
	{
		if($this->_helper->getHelper('FlashMessenger')->getMessages()){
			$this->view->messages=$this->_helper
				->getHelper('FlashMessenger')->getMessages();
				//header("Refresh:3;/main");
				
			}else{
					$this->_redirect('/');
				 }
	}
	public function searchformAction()
	{
	$this->searchform=new Myblog_Form_Search;
	$this->view->search=$this->searchform;
	}
	
}






